package com.label.Model.Vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.label.Model.Do.Role;
import com.label.Utils.Common.InfoUtil;
import lombok.Data;

import java.util.List;

@Data
public class UserAllVo {

    @JSONField(serializeUsing= ToStringSerializer.class)
    private Long id;

    private String account;

    private String password;

    private String userName;

    private String unitId;

    private String schoolId;

    private String majorId;

    private String classId;

    private String opLevel;

    private String phone;

    private String email;

    private String department;

    private String parentEmail;

    private String picPath;

    private List<Role> roles;

    private UserBaseInfo info;

    public String getUnitName() {
        if(unitId!=null ){
            return InfoUtil.getUnitName(unitId);
        }
        return null;
    }

    public String getSchoolName() {
        if(schoolId!=null){
            return InfoUtil.getSchoolName(schoolId);
        }
        return null;
    }

    public String getDepartmentName() {
        if(department!=null){
            return InfoUtil.getDepartmentName(department);
        }
        return null;
    }

}
